package edu.seu.mart.dao.impl;

import edu.seu.mart.dao.BaseDao;
import edu.seu.mart.dao.ICartDao;

import edu.seu.mart.entity.Pager;
import edu.seu.mart.model.Cart;
import org.springframework.stereotype.Repository;


/**
 * Created by Administrator on 2015/3/10.
 */
@Repository
public class CartDao extends BaseDao<Cart> implements ICartDao {

    @Override
    public Pager<Cart> findUserCart(int userId) {
        return this.find("from Cart where user_id = '" + userId + "'");
    }

    @Override
    public int getCount(int userId) {
        return (int)this.find("from Cart where user_id = '" + userId + "'").getTotal();
    }
}
